package org.afs.gescol.core.model.data;

import javax.persistence.AttributeOverride;
import javax.persistence.AttributeOverrides;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import org.afs.gescol.core.model.references.Cycle;
import org.afs.gescol.core.model.references.Level;
import org.afs.gescol.core.model.references.Series;
import org.afs.gescol.core.model.references.Subject;
import org.hibernate.annotations.ForeignKey;
import org.scub.foundation.framework.core.model.BaseModel;

/**
 * Data model for subject assignment.
 * @autor Kobla GBENYO (kobla.gbenyo@gmail.com)
 */
@Entity
@Table(name = "data_subject_assignment")
@AttributeOverrides({@AttributeOverride(name = "id", column = @Column(name = "subject_assignment_id", nullable = false)),
    @AttributeOverride(name = "version", column = @Column(name = "subject_assignment_version", nullable = false, unique = false)),
})
public class SubjectAssignment extends BaseModel {

    /** Serial Version UID. */
    private static final long serialVersionUID = -4087735471283809719L;

    /** Subject Assignment Override Short label. */
    @Column(name = "subject_assignment_short_label", nullable = true)
    private String overrideShortLabel;

    /** Subject Assignment Override Long label. */
    @Column(name = "subject_assignment_long_label", nullable = true)
    private String overrideLongLabel;

    @ManyToOne
    @JoinColumn(name = "subject_id")
    @ForeignKey(name = "fk_data_subject_assignment_ref_subject_id")
    private Subject assignedSubject;

    /** Subject Assignment Coefficient. */
    @Column(name = "subject_assignment_coefficient", nullable = false)
    private float assignedSubjectCoef;

    /** Subject Assignment weekly hourly volume. */
    @Column(name = "subject_assignment_hourly_volume", nullable = false)
    private int assignedSubjectHourlyVolume;

    @ManyToOne
    @JoinColumn(name = "cycle_id")
    @ForeignKey(name = "fk_data_subject_assignment_ref_cycle_id")
    private Cycle assignedSubjectCycle;

    @ManyToOne
    @JoinColumn(name = "level_id")
    @ForeignKey(name = "fk_data_subject_assignment_ref_level_id")
    private Level assignedSubjectLevel;

    @ManyToOne
    @JoinColumn(name = "series_id")
    @ForeignKey(name = "fk_data_subject_assignment_ref_series_id")
    private Series assignedSubjectSeries;

    /**
     * Get the value of overrideShortLabel.
     * @return the overrideShortLabel
     */
    public String getOverrideShortLabel() {
        return overrideShortLabel;
    }

    /**
     * Get the value of overrideLongLabel.
     * @return the overrideLongLabel
     */
    public String getOverrideLongLabel() {
        return overrideLongLabel;
    }

    /**
     * Get the value of assignedSubject.
     * @return the assignedSubject
     */
    public Subject getAssignedSubject() {
        return assignedSubject;
    }

    /**
     * Get the value of assignedSubjectCoef.
     * @return the assignedSubjectCoef
     */
    public float getAssignedSubjectCoef() {
        return assignedSubjectCoef;
    }

    /**
     * Get the value of assignedSubjectCycle.
     * @return the assignedSubjectCycle
     */
    public Cycle getAssignedSubjectCycle() {
        return assignedSubjectCycle;
    }

    /**
     * Get the value of assignedSubjectLevel.
     * @return the assignedSubjectLevel
     */
    public Level getAssignedSubjectLevel() {
        return assignedSubjectLevel;
    }

    /**
     * Get the value of assignedSubjectSeries.
     * @return the assignedSubjectSeries
     */
    public Series getAssignedSubjectSeries() {
        return assignedSubjectSeries;
    }

    /**
     * Get the value of assignedSubjectHourlyVolume.
     * @return the assignedSubjectHourlyVolume
     */
    public int getAssignedSubjectHourlyVolume() {
        return assignedSubjectHourlyVolume;
    }

    /**
     * Set the value of assignedSubjectHourlyVolume.
     * @param assignedSubjectHourlyVolume the assignedSubjectHourlyVolume to set
     */
    public void setAssignedSubjectHourlyVolume(int assignedSubjectHourlyVolume) {
        this.assignedSubjectHourlyVolume = assignedSubjectHourlyVolume;
    }

    /**
     * Set the value of overrideShortLabel.
     * @param overrideShortLabel the overrideShortLabel to set
     */
    public void setOverrideShortLabel(String overrideShortLabel) {
        this.overrideShortLabel = overrideShortLabel;
    }

    /**
     * Set the value of overrideLongLabel.
     * @param overrideLongLabel the overrideLongLabel to set
     */
    public void setOverrideLongLabel(String overrideLongLabel) {
        this.overrideLongLabel = overrideLongLabel;
    }

    /**
     * Set the value of assignedSubject.
     * @param assignedSubject the assignedSubject to set
     */
    public void setAssignedSubject(Subject assignedSubject) {
        this.assignedSubject = assignedSubject;
    }

    /**
     * Set the value of assignedSubjectCoef.
     * @param assignedSubjectCoef the assignedSubjectCoef to set
     */
    public void setAssignedSubjectCoef(float assignedSubjectCoef) {
        this.assignedSubjectCoef = assignedSubjectCoef;
    }

    /**
     * Set the value of assignedSubjectCycle.
     * @param assignedSubjectCycle the assignedSubjectCycle to set
     */
    public void setAssignedSubjectCycle(Cycle assignedSubjectCycle) {
        this.assignedSubjectCycle = assignedSubjectCycle;
    }

    /**
     * Set the value of assignedSubjectLevel.
     * @param assignedSubjectLevel the assignedSubjectLevel to set
     */
    public void setAssignedSubjectLevel(Level assignedSubjectLevel) {
        this.assignedSubjectLevel = assignedSubjectLevel;
    }

    /**
     * Set the value of assignedSubjectSeries.
     * @param assignedSubjectSeries the assignedSubjectSeries to set
     */
    public void setAssignedSubjectSeries(Series assignedSubjectSeries) {
        this.assignedSubjectSeries = assignedSubjectSeries;
    }

    @Override
    public boolean equals(Object other) {
        return equalsUtil(other);
    }

    @Override
    public int hashCode() {
        return super.hashCode();
    }

}
